//
//  TransferViewController.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/6/19.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit

class TransferViewController: BaseViewController {
    var viewModel:TransferViewModel?
    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
        viewModel = TransferViewModel(controller: self)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        self.title = kText("划转")
        //获取默认资产  转出获取币币的资产  转出获取法币/杠杆的资产
        if !AppSecurityInfo.default.model.isTradePwd {
            AppSecurityInfo.default.archiveSecurityInfo()
        }
        if viewModel?.model.coinCode.count != 0 {
            if viewModel?.sendCoin == .legalType {
                viewModel?.selectIndex = (viewModel?.archiveLegalAsset())!
            }else if viewModel?.sendCoin == .coinType {
                viewModel?.selectIndex = (viewModel?.archiveCoinAsset())!
            }else {
                viewModel?.selectIndex = (viewModel?.archiveLeverAsset())!
            }
            
        }else {
        viewModel?.archiveDefautAsset()
        }
        let transView = TransferView(dataSource: viewModel)
        self.view.addSubview(transView)
        transView.snp.makeConstraints { (make) in
            make.top.bottom.left.right.equalToSuperview()
        }
        transView.setModel()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
